<template>
    <div class="header">
        <mt-header :title="title" fixed>
            <router-link to="" slot="left" v-show="$route.meta.back && back">
                <mt-button icon="back" @click.native="$router.back(-1)" ></mt-button>
            </router-link>
        </mt-header>
        <mt-popup
        v-model="popupVisible"
        position="top"
        :modal="false">
        暂未关注公众号,请点击关注
        <a class="iconfont icon-shangchuan btn" href="https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=MzU1MTY5NzgwOA==&scene=124#wechat_redirect">关注</a>
        </mt-popup>
    </div>
</template>
<script>
export default {
    props:["title"],
    name:"Header",
    data() {
        return {
            popupVisible:false,
            back:true,
        }
    },
    created(){
        let u = navigator.userAgent;
        let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
        let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
            if(isiOS){
                //ios系统输出
                this.back = false;
            }else{
                //android系统输出
                this.back = true;
            }
        // console.log(this.$route);
        if(!this.$store.getters.subscribe && this.$route.name !== 'login'){
            this.popupVisible = true
        }
    }
}
</script>
<style scoped>
    .header {
        height: 3rem;
    }
    .mint-header {
        height: 3rem;
        background-color:#fff;
        font-size: 1rem;
        z-index: 100;
        color: #000;
    }
    .mintui {
        font-size: 1rem;
    }
    .mint-popup{
        text-align: center;
        width: 100%;
        height: 3rem;
        line-height: 3rem;
        font-size:1rem;
        background:#3338;
        color: #fff;
    }
    .btn{
        width: 4rem;
        height: 1.5rem;
        margin: 0;
        font-size: 0.8rem;
        margin-left:0.6rem;
        padding:0.4rem;
    }
</style>